package cn.zsb.zsb.service;//package cn.zsb.zsb.service;
//
//import cn.zsb.zsb.entity.*;
////import cn.online.zhuanshenben.util.MybatisUtil;
//import org.apache.ibatis.session.SqlSession;
//

import cn.zsb.zsb.dao.SadminMapper;
import cn.zsb.zsb.entity.Sadmin;
import cn.zsb.zsb.entity.SadminExample;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//
///**
// * @author oldliu
// * @since 1.0
// */
@Service
public class AdminService {
    //    @Autowired
//    private SqlSessionTemplate template;
    @Autowired
    private SadminMapper mapper;

    public Sadmin login(String u, String p) {

        SadminExample admin = new SadminExample();
        SadminExample.Criteria cr = admin.createCriteria();
        cr.andSadminEqualTo(u);
        cr.andSpassEqualTo(p);
        List<Sadmin> list = mapper.selectByExample(admin);
        return list.size() == 0 ? null : list.get(0);

    }

}
